import { ElButton } from 'element-plus';
export default function() {
	let level = 1;
	const area = this.area({
		header: '无限弹框示例'
	});
	const dialog = this.dialog();
	const config = (show) => ({
		title: `当前层级【第${level++}层】`,
		children: [{
				is: ElButton,
				children: '新弹出一层',
				onClick: () => dialog.open(config)
			},
			{
				is: ElButton,
				children: '关闭当前层',
				onClick: () => show.value = false
			},
			{
				is: ElButton,
				children: '关闭最上层',
				onClick: () => dialog.close()
			},
			{
				is: ElButton,
				children: '关闭所有层',
				onClick: () => {
					level = 1;
					dialog.closeAll();
				},
			}
		]
	});
	area.add({
		is: ElButton,
		type: 'primary',
		children: '开启无限弹框',
		onClick: () => dialog.open(config),
	}).done();
}